package com.qianxx.component.activity.chart.slip_band_area_chart;

import android.graphics.Color;
import android.os.Bundle;

import com.qianxx.component.R;
import com.qianxx.component.activity.base.BaseActivity;
import com.qianxx.viewlibrary.chart.axis.Axis;
import com.qianxx.viewlibrary.chart.entity.DateValueEntity;
import com.qianxx.viewlibrary.chart.entity.LineEntity;
import com.qianxx.viewlibrary.chart.event.IZoomable;
import com.qianxx.viewlibrary.chart.view.SlipBandAreaChart;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class SlipBandAreaChartActivity extends BaseActivity {
    @BindView(R.id.slip_band_area_chart)
    SlipBandAreaChart slip_band_area_chart;

    List<LineEntity<DateValueEntity>> lines = new ArrayList<>();
    List<DateValueEntity> dv1 = new ArrayList<>();
    List<DateValueEntity> dv2 = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_slip_band_area_chart);
        ButterKnife.bind(this);

        initData();
        initView();
    }

    private void initData() {
        dv1.add(new DateValueEntity(947.3056f,"20130424"));
        dv1.add(new DateValueEntity(952.2242f,"20130425"));
        dv1.add(new DateValueEntity(963.2635f,"20130426"));
        dv1.add(new DateValueEntity(961.9385f,"20130502"));
        dv1.add(new DateValueEntity(962.3391f,"20130503"));
        dv1.add(new DateValueEntity(961.9631f,"20130506"));
        dv1.add(new DateValueEntity(961.916f,"20130507"));
        dv1.add(new DateValueEntity(961.9375f,"20130508"));
        dv1.add(new DateValueEntity(962.1758f,"20130509"));
        dv1.add(new DateValueEntity(962.1837f,"20130510"));
        dv1.add(new DateValueEntity(962.1995f,"20130513"));
        dv1.add(new DateValueEntity(962.1158f,"20130514"));
        dv1.add(new DateValueEntity(962.2931f,"20130515"));
        dv1.add(new DateValueEntity(963.1225f,"20130516"));
        dv1.add(new DateValueEntity(965.0629f,"20130517"));
        dv1.add(new DateValueEntity(969.385f,"20130520"));
        dv1.add(new DateValueEntity(975.5116f,"20130521"));
        dv1.add(new DateValueEntity(974.0666f,"20130522"));
        dv1.add(new DateValueEntity(974.2079f,"20130523"));
        dv1.add(new DateValueEntity(977.2924f,"20130524"));
        dv1.add(new DateValueEntity(977.4907f,"20130527"));
        dv1.add(new DateValueEntity(976.429f,"20130528"));
        dv1.add(new DateValueEntity(977.8235f,"20130529"));
        dv1.add(new DateValueEntity(981.4609f,"20130530"));
        dv1.add(new DateValueEntity(983.0612f,"20130531"));
        dv1.add(new DateValueEntity(978.343f,"20130603"));
        dv1.add(new DateValueEntity(972.4412f,"20130604"));
        dv1.add(new DateValueEntity(965.072f,"20130605"));
        dv1.add(new DateValueEntity(954.1762f,"20130606"));
        dv1.add(new DateValueEntity(941.5963f,"20130607"));
        dv1.add(new DateValueEntity(921.8664f,"20130613"));
        dv1.add(new DateValueEntity(905.6599f,"20130614"));
        dv1.add(new DateValueEntity(891.2146f,"20130617"));
        dv1.add(new DateValueEntity(879.2878f,"20130618"));
        dv1.add(new DateValueEntity(865.2361f,"20130619"));
        dv1.add(new DateValueEntity(843.2399f,"20130620"));
        dv1.add(new DateValueEntity(821.4298f,"20130621"));
        dv1.add(new DateValueEntity(784.0339f,"20130624"));
        dv1.add(new DateValueEntity(759.5865f,"20130625"));
        dv1.add(new DateValueEntity(738.5209f,"20130626"));
        dv1.add(new DateValueEntity(723.5436f,"20130627"));
        dv1.add(new DateValueEntity(720.2877f,"20130628"));
        dv1.add(new DateValueEntity(718.5511f,"20130701"));
        dv1.add(new DateValueEntity(720.9672f,"20130702"));
        dv1.add(new DateValueEntity(725.9567f,"20130703"));
        dv1.add(new DateValueEntity(726.3284f,"20130704"));
        dv1.add(new DateValueEntity(728.0508f,"20130705"));
        dv1.add(new DateValueEntity(728.961f,"20130708"));
        dv1.add(new DateValueEntity(730.1062f,"20130709"));
        dv1.add(new DateValueEntity(734.6287f,"20130710"));
        dv1.add(new DateValueEntity(736.1662f,"20130711"));
        dv1.add(new DateValueEntity(739.5985f,"20130712"));
        dv1.add(new DateValueEntity(743.5045f,"20130715"));
        dv1.add(new DateValueEntity(749.4669f,"20130716"));
        dv1.add(new DateValueEntity(753.7623f,"20130717"));
        dv1.add(new DateValueEntity(753.6917f,"20130718"));
        dv1.add(new DateValueEntity(752.4678f,"20130719"));
        dv1.add(new DateValueEntity(760.7568f,"20130722"));
        dv1.add(new DateValueEntity(765.0131f,"20130723"));
        dv1.add(new DateValueEntity(768.8569f,"20130724"));
        dv1.add(new DateValueEntity(770.9514f,"20130725"));
        dv1.add(new DateValueEntity(768.5318f,"20130726"));
        dv1.add(new DateValueEntity(762.7225f,"20130729"));
        dv1.add(new DateValueEntity(759.3295f,"20130730"));
        dv1.add(new DateValueEntity(757.1793f,"20130731"));
        dv1.add(new DateValueEntity(756.1526f,"20130801"));
        dv1.add(new DateValueEntity(755.1125f,"20130802"));
        dv1.add(new DateValueEntity(756.6308f,"20130805"));
        dv1.add(new DateValueEntity(757.8153f,"20130806"));
        dv1.add(new DateValueEntity(757.0371f,"20130807"));
        dv1.add(new DateValueEntity(763.2288f,"20130808"));
        dv1.add(new DateValueEntity(764.5119f,"20130809"));
        dv1.add(new DateValueEntity(767.9202f,"20130812"));
        dv1.add(new DateValueEntity(770.146f,"20130813"));
        dv1.add(new DateValueEntity(772.2369f,"20130814"));
        dv1.add(new DateValueEntity(772.1298f,"20130815"));
        dv1.add(new DateValueEntity(771.5269f,"20130816"));
        dv1.add(new DateValueEntity(770.4365f,"20130819"));
        dv1.add(new DateValueEntity(767.9823f,"20130820"));
        dv1.add(new DateValueEntity(767.901f,"20130821"));
        dv1.add(new DateValueEntity(768.2333f,"20130822"));
        dv1.add(new DateValueEntity(769.7356f,"20130823"));
        dv1.add(new DateValueEntity(772.7566f,"20130826"));
        dv1.add(new DateValueEntity(771.9353f,"20130827"));
        dv1.add(new DateValueEntity(772.5748f,"20130828"));
        dv1.add(new DateValueEntity(774.17f,"20130829"));
        dv1.add(new DateValueEntity(776.6239f,"20130830"));
        dv1.add(new DateValueEntity(779.4005f,"20130902"));
        dv1.add(new DateValueEntity(782.8205f,"20130903"));
        dv1.add(new DateValueEntity(787.7852f,"20130904"));
        dv1.add(new DateValueEntity(795.1398f,"20130905"));
        dv1.add(new DateValueEntity(798.0329f,"20130906"));
        dv1.add(new DateValueEntity(777.0803f,"20130909"));
        dv1.add(new DateValueEntity(745.4303f,"20130910"));
        dv1.add(new DateValueEntity(733.794f,"20130911"));
        dv1.add(new DateValueEntity(713.0938f,"20130912"));
        dv1.add(new DateValueEntity(709.4212f,"20130913"));
        dv1.add(new DateValueEntity(715.0446f,"20130916"));
        dv1.add(new DateValueEntity(727.5064f,"20130917"));
        dv1.add(new DateValueEntity(742.578f,"20130918"));
        dv1.add(new DateValueEntity(759.8558f,"20130923"));
        dv1.add(new DateValueEntity(781.4722f,"20130924"));
        dv1.add(new DateValueEntity(799.6322f,"20130925"));
        dv1.add(new DateValueEntity(813.7519f,"20130926"));
        dv1.add(new DateValueEntity(828.4345f,"20130927"));
        dv1.add(new DateValueEntity(844.6599f,"20130930"));
        dv1.add(new DateValueEntity(861.8906f,"20131008"));
        dv1.add(new DateValueEntity(881.4863f,"20131009"));
        dv1.add(new DateValueEntity(897.0036f,"20131010"));
        dv1.add(new DateValueEntity(918.4781f,"20131011"));
        dv1.add(new DateValueEntity(940.6985f,"20131014"));
        dv1.add(new DateValueEntity(951.0224f,"20131015"));
        dv1.add(new DateValueEntity(942.7723f,"20131016"));
        dv1.add(new DateValueEntity(932.7551f,"20131017"));
        dv1.add(new DateValueEntity(924.7807f,"20131018"));
        dv1.add(new DateValueEntity(936.6127f,"20131021"));
        dv1.add(new DateValueEntity(945.5508f,"20131022"));
        dv1.add(new DateValueEntity(952.1615f,"20131023"));
        dv1.add(new DateValueEntity(950.4466f,"20131024"));
        dv1.add(new DateValueEntity(953.2289f,"20131025"));
        dv1.add(new DateValueEntity(963.9264f,"20131028"));
        dv1.add(new DateValueEntity(968.6712f,"20131029"));
        dv1.add(new DateValueEntity(972.3124f,"20131030"));
        dv1.add(new DateValueEntity(972.3439f,"20131031"));
        dv1.add(new DateValueEntity(971.8104f,"20131101"));
        dv1.add(new DateValueEntity(972.5886f,"20131104"));


        dv2.add(new DateValueEntity(1059.5943f,"20130424"));
        dv2.add(new DateValueEntity(1046.7757f,"20130425"));
        dv2.add(new DateValueEntity(1026.9364f,"20130426"));
        dv2.add(new DateValueEntity(1026.2614f,"20130502"));
        dv2.add(new DateValueEntity(1024.6608f,"20130503"));
        dv2.add(new DateValueEntity(1025.8368f,"20130506"));
        dv2.add(new DateValueEntity(1026.1839f,"20130507"));
        dv2.add(new DateValueEntity(1026.0624f,"20130508"));
        dv2.add(new DateValueEntity(1026.3241f,"20130509"));
        dv2.add(new DateValueEntity(1026.2162f,"20130510"));
        dv2.add(new DateValueEntity(1026.4004f,"20130513"));
        dv2.add(new DateValueEntity(1025.9841f,"20130514"));
        dv2.add(new DateValueEntity(1026.3068f,"20130515"));
        dv2.add(new DateValueEntity(1028.6774f,"20130516"));
        dv2.add(new DateValueEntity(1031.737f,"20130517"));
        dv2.add(new DateValueEntity(1035.6149f,"20130520"));
        dv2.add(new DateValueEntity(1036.5883f,"20130521"));
        dv2.add(new DateValueEntity(1040.2333f,"20130522"));
        dv2.add(new DateValueEntity(1039.392f,"20130523"));
        dv2.add(new DateValueEntity(1039.9075f,"20130524"));
        dv2.add(new DateValueEntity(1042.3092f,"20130527"));
        dv2.add(new DateValueEntity(1049.7709f,"20130528"));
        dv2.add(new DateValueEntity(1054.7764f,"20130529"));
        dv2.add(new DateValueEntity(1058.339f,"20130530"));
        dv2.add(new DateValueEntity(1061.3387f,"20130531"));
        dv2.add(new DateValueEntity(1063.1569f,"20130603"));
        dv2.add(new DateValueEntity(1065.8587f,"20130604"));
        dv2.add(new DateValueEntity(1069.2279f,"20130605"));
        dv2.add(new DateValueEntity(1074.9237f,"20130606"));
        dv2.add(new DateValueEntity(1080.7036f,"20130607"));
        dv2.add(new DateValueEntity(1090.4335f,"20130613"));
        dv2.add(new DateValueEntity(1097.14f,"20130614"));
        dv2.add(new DateValueEntity(1101.7853f,"20130617"));
        dv2.add(new DateValueEntity(1102.9121f,"20130618"));
        dv2.add(new DateValueEntity(1103.4638f,"20130619"));
        dv2.add(new DateValueEntity(1105.56f,"20130620"));
        dv2.add(new DateValueEntity(1106.7701f,"20130621"));
        dv2.add(new DateValueEntity(1115.766f,"20130624"));
        dv2.add(new DateValueEntity(1116.7134f,"20130625"));
        dv2.add(new DateValueEntity(1113.479f,"20130626"));
        dv2.add(new DateValueEntity(1104.3563f,"20130627"));
        dv2.add(new DateValueEntity(1084.9122f,"20130628"));
        dv2.add(new DateValueEntity(1063.1488f,"20130701"));
        dv2.add(new DateValueEntity(1036.8327f,"20130702"));
        dv2.add(new DateValueEntity(1007.5432f,"20130703"));
        dv2.add(new DateValueEntity(989.9715f,"20130704"));
        dv2.add(new DateValueEntity(971.9491f,"20130705"));
        dv2.add(new DateValueEntity(953.6389f,"20130708"));
        dv2.add(new DateValueEntity(937.1937f,"20130709"));
        dv2.add(new DateValueEntity(920.2712f,"20130710"));
        dv2.add(new DateValueEntity(917.1337f,"20130711"));
        dv2.add(new DateValueEntity(908.4014f,"20130712"));
        dv2.add(new DateValueEntity(899.9954f,"20130715"));
        dv2.add(new DateValueEntity(888.733f,"20130716"));
        dv2.add(new DateValueEntity(880.0376f,"20130717"));
        dv2.add(new DateValueEntity(877.9082f,"20130718"));
        dv2.add(new DateValueEntity(876.6321f,"20130719"));
        dv2.add(new DateValueEntity(872.6431f,"20130722"));
        dv2.add(new DateValueEntity(871.7868f,"20130723"));
        dv2.add(new DateValueEntity(870.243f,"20130724"));
        dv2.add(new DateValueEntity(869.5485f,"20130725"));
        dv2.add(new DateValueEntity(868.8681f,"20130726"));
        dv2.add(new DateValueEntity(870.3774f,"20130729"));
        dv2.add(new DateValueEntity(870.6704f,"20130730"));
        dv2.add(new DateValueEntity(871.0206f,"20130731"));
        dv2.add(new DateValueEntity(870.7473f,"20130801"));
        dv2.add(new DateValueEntity(870.4874f,"20130802"));
        dv2.add(new DateValueEntity(870.4691f,"20130805"));
        dv2.add(new DateValueEntity(870.3846f,"20130806"));
        dv2.add(new DateValueEntity(870.1628f,"20130807"));
        dv2.add(new DateValueEntity(855.2711f,"20130808"));
        dv2.add(new DateValueEntity(849.188f,"20130809"));
        dv2.add(new DateValueEntity(843.2797f,"20130812"));
        dv2.add(new DateValueEntity(839.8539f,"20130813"));
        dv2.add(new DateValueEntity(836.363f,"20130814"));
        dv2.add(new DateValueEntity(836.6701f,"20130815"));
        dv2.add(new DateValueEntity(840.073f,"20130816"));
        dv2.add(new DateValueEntity(846.1634f,"20130819"));
        dv2.add(new DateValueEntity(852.3176f,"20130820"));
        dv2.add(new DateValueEntity(856.8989f,"20130821"));
        dv2.add(new DateValueEntity(860.7666f,"20130822"));
        dv2.add(new DateValueEntity(863.7643f,"20130823"));
        dv2.add(new DateValueEntity(870.7433f,"20130826"));
        dv2.add(new DateValueEntity(882.6646f,"20130827"));
        dv2.add(new DateValueEntity(893.4251f,"20130828"));
        dv2.add(new DateValueEntity(901.1299f,"20130829"));
        dv2.add(new DateValueEntity(908.776f,"20130830"));
        dv2.add(new DateValueEntity(915.0994f,"20130902"));
        dv2.add(new DateValueEntity(922.2794f,"20130903"));
        dv2.add(new DateValueEntity(928.6147f,"20130904"));
        dv2.add(new DateValueEntity(932.6601f,"20130905"));
        dv2.add(new DateValueEntity(945.367f,"20130906"));
        dv2.add(new DateValueEntity(988.5196f,"20130909"));
        dv2.add(new DateValueEntity(1049.9696f,"20130910"));
        dv2.add(new DateValueEntity(1091.2059f,"20130911"));
        dv2.add(new DateValueEntity(1152.2061f,"20130912"));
        dv2.add(new DateValueEntity(1191.8787f,"20130913"));
        dv2.add(new DateValueEntity(1216.6553f,"20130916"));
        dv2.add(new DateValueEntity(1227.3935f,"20130917"));
        dv2.add(new DateValueEntity(1237.8219f,"20130918"));
        dv2.add(new DateValueEntity(1247.9441f,"20130923"));
        dv2.add(new DateValueEntity(1250.2277f,"20130924"));
        dv2.add(new DateValueEntity(1252.4677f,"20130925"));
        dv2.add(new DateValueEntity(1250.548f,"20130926"));
        dv2.add(new DateValueEntity(1248.2654f,"20130927"));
        dv2.add(new DateValueEntity(1243.74f,"20130930"));
        dv2.add(new DateValueEntity(1238.9093f,"20131008"));
        dv2.add(new DateValueEntity(1232.3136f,"20131009"));
        dv2.add(new DateValueEntity(1225.6963f,"20131010"));
        dv2.add(new DateValueEntity(1218.3218f,"20131011"));
        dv2.add(new DateValueEntity(1207.7014f,"20131014"));
        dv2.add(new DateValueEntity(1202.7775f,"20131015"));
        dv2.add(new DateValueEntity(1204.8276f,"20131016"));
        dv2.add(new DateValueEntity(1199.0448f,"20131017"));
        dv2.add(new DateValueEntity(1193.1192f,"20131018"));
        dv2.add(new DateValueEntity(1159.9872f,"20131021"));
        dv2.add(new DateValueEntity(1131.2491f,"20131022"));
        dv2.add(new DateValueEntity(1109.9384f,"20131023"));
        dv2.add(new DateValueEntity(1103.1533f,"20131024"));
        dv2.add(new DateValueEntity(1091.071f,"20131025"));
        dv2.add(new DateValueEntity(1070.0735f,"20131028"));
        dv2.add(new DateValueEntity(1062.0287f,"20131029"));
        dv2.add(new DateValueEntity(1056.4875f,"20131030"));
        dv2.add(new DateValueEntity(1058.056f,"20131031"));
        dv2.add(new DateValueEntity(1060.3895f,"20131101"));
        dv2.add(new DateValueEntity(1061.7113f,"20131104"));

        LineEntity<DateValueEntity> MA5 = new LineEntity<DateValueEntity>();
        MA5.setTitle("HIGH");
        MA5.setLineColor(Color.BLUE);
        MA5.setLineData(dv1);
        lines.add(MA5);

        LineEntity<DateValueEntity> MA10 = new LineEntity<DateValueEntity>();
        MA10.setTitle("LOW");
        MA10.setLineColor(Color.RED);
        MA10.setLineData(dv2);
        lines.add(MA10);
    }

    private void initView() {
        slip_band_area_chart.setAxisXColor(Color.LTGRAY);
        slip_band_area_chart.setAxisYColor(Color.LTGRAY);
        slip_band_area_chart.setBorderColor(Color.LTGRAY);
        slip_band_area_chart.setLongitudeFontSize(14);
        slip_band_area_chart.setLongitudeFontColor(Color.BLACK);
        slip_band_area_chart.setLatitudeColor(Color.GRAY);
        slip_band_area_chart.setLatitudeFontColor(Color.BLACK);
        slip_band_area_chart.setLongitudeColor(Color.GRAY);
        slip_band_area_chart.setMaxValue(1300);
        slip_band_area_chart.setMinValue(700);
        slip_band_area_chart.setDisplayFrom(10);
        slip_band_area_chart.setDisplayNumber(30);
        slip_band_area_chart.setMinDisplayNumber(5);
        slip_band_area_chart.setZoomBaseLine(IZoomable.ZOOM_BASE_LINE_CENTER);
        slip_band_area_chart.setDisplayLongitudeTitle(true);
        slip_band_area_chart.setDisplayLatitudeTitle(true);
        slip_band_area_chart.setDisplayLatitude(true);
        slip_band_area_chart.setDisplayLongitude(true);
        slip_band_area_chart.setDataQuadrantPaddingTop(5);
        slip_band_area_chart.setDataQuadrantPaddingBottom(5);
        slip_band_area_chart.setDataQuadrantPaddingLeft(5);
        slip_band_area_chart.setDataQuadrantPaddingRight(5);
        slip_band_area_chart.setAxisXPosition(Axis.AXIS_X_POSITION_BOTTOM);
        slip_band_area_chart.setAxisYPosition(Axis.AXIS_Y_POSITION_LEFT);
        slip_band_area_chart.setDisplayBorder(false);
        slip_band_area_chart.setCrossLinesColor(Color.BLACK);
        slip_band_area_chart.setLinesData(lines);
    }

    @Override
    public String setTitle() {
        return "SlipBandAreaChart";
    }
}
